package com.bilubi.reggie.reggie.mapper;

import com.bilubi.reggie.reggie.annotation.AutoFill;
import com.bilubi.reggie.reggie.bean.AddressBook;
import com.bilubi.reggie.reggie.enums.OperateType;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AddressBookMapper {
    int deleteByPrimaryKey(Long id);

    int insert(AddressBook record);

    @AutoFill(value = {OperateType.INSERT, OperateType.USERID})
    int insertSelective(AddressBook record);

    AddressBook selectByPrimaryKey(Long id);

    @AutoFill(value = {OperateType.UPDATE, OperateType.USERID})
    int updateByPrimaryKeySelective(AddressBook record);

    int updateByPrimaryKey(AddressBook record);

    List<AddressBook> selectByUserId(Long userId);

    @AutoFill(value = {OperateType.UPDATE, OperateType.USERID})
    int deleteDefaultByUserId(AddressBook record);

    @AutoFill(value = OperateType.USERID)
    AddressBook selectDefaultByUserId(AddressBook addressBook);
}